<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <title>RealClouds | Login</title>
    {% template "header-meta" . %}
</head>

<body>
    <header>
        <nav id="navApp" class="navbar navbar-toggleable-md navbar-inverse bg-primary">
            <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#defaultNavbar" aria-controls="defaultNavbar" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <a class="navbar-brand" href="#">RealClouds</a>
            <div class="collapse navbar-collapse" id="defaultNavbar">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item active">
                        <a class="nav-link" href="../">首页<span class="sr-only">Home(current)</span></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="http://www.realclouds.org">关于我们</a>
                    </li>
                </ul>
                <button class="btn btn-outline-secondary" type="submit" v-on:click="logout">退出</button>
            </div>
        </nav>
    </header>
    <div id="sshApp" class="container-fluid m-t-30">
        <div class="row m-b-20">
            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <div class="card">
                    <div class="card-header">
                        信息填充
                    </div>
                    <div class="card-block">
                        <div class="form-group">
                            <div class="input-group">
                                <div class="input-group-addon">命令</div>
                                <input type="text" required class="form-control" v-model="cmd" placeholder="Value">
                            </div>
                        </div>
                        <hr>
                        <div class="row">
                            <div v-for="v in vars" class="col-xl-2 col-lg-3 col-md-6 col-sm-6 col-xs-1">
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" class="form-control" v-model="v.name" placeholder="Value" readonly>
                                        <div class="input-group-addon">=</div>
                                        <input type="text" class="form-control" v-model="v.val" placeholder="Value">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row m-b-20">
            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 text-right">
                <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".stopWSModal">执行命令</button>
            </div>
            <div class="modal fade stopWSModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="modal-title">系统确认</h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                                <span class="sr-only">Close</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            您确定要在远端主机执行以下命令么？<br><br><small><mark>【 {{cmd}} 】</mark></small><br><br>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" v-on:click="sshSubmit">执行</button>
                            <button type="button" class="btn btn-primary" data-dismiss="modal">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <div class="card m-b-20">
                    <div class="card-header">
                        执行进度
                    </div>
                    <div class="card-block">
                        <h3 class="card-title"> {{ stitle }}</h3>
                        <textarea id="resultText" rows="10" style="width:100%;overflow-y:auto;resize:none;" v-model="result"></textarea>
                    </div>
                </div>
            </div>
        </div>
        <hr>
        <footer>
            <p>&copy; RealClouds.org 2017</p>
        </footer>
    </div>
    {% template "footer-pubjs" . %}
    <script type="text/javascript" src="/ws/realclouds_ws.js"></script>
    <script type="text/javascript">
        //要执行命令
        var shellCmd = "wget http://www.golangtc.com/static/go/1.8/go1.8.linux-amd64.tar.gz";

        //要执行 Shell 的变量
        var shellVars = [{
            name: "H2",
            val: ""
        }, {
            name: "H3",
            val: ""
        }, {
            name: "H4",
            val: ""
        }, {
            name: "H5",
            val: ""
        }, {
            name: "H6",
            val: ""
        }];

        rco.defautInit("#sshApp", ".stopWSModal", "#resultText", shellCmd, shellVars);
        rco.navApp("#navApp");
    </script>
</body>

</html>